package com.hljx.entity;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.hljx.config.BaseEntity;
import java.time.LocalDateTime;
import java.util.Objects;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;

/**
 * <p>
 * 核算单元管理
 * </p>
 *
 * @author gx
 * @since 2023-09-18
 */
@Getter
@Setter
@TableName("sys_accounting_unit")
public class SysAccountingUnit extends BaseEntity {

    /**
     * 院区id
     */
    @TableField("hospital_id")
    @ExcelIgnore
    private Long hospitalId;

    /**
     * 字典数据项id(类别)
     */
    @TableField("dict_item_id")
    @ExcelIgnore
    private Long dictItemId;

    /**
     * 核算单元名称
     */
    @TableField("name")
    @ExcelProperty(value = "核算单元名称", index = 0)
    @ColumnWidth(30)
    private String name;

    /**
     * 核算单元编码
     */
    @TableField("code")
    @ExcelProperty(value = "核算单元编码", index = 1)
    @ColumnWidth(30)
    private String code;

    @Schema(description = "类别")
    @ExcelProperty(value = "类别", index = 2)
    @ColumnWidth(30)
    @TableField(exist = false)
    private String typeName;

    @Schema(description = "所属院区")
    @ExcelProperty(value = "所属院区", index = 3)
    @ColumnWidth(30)
    @TableField(exist = false)
    private String hospitalAreaName;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        SysAccountingUnit that = (SysAccountingUnit) o;

        return Objects.equals(code, that.code);
    }

    @Override
    public int hashCode() {
        int result = 0;
        result = 31 * result + (code != null ? code.hashCode() : 0);
        return result;
    }
}
